home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
pcboard
/
cbfree13.zip
/
PHONE101.ZIP
/
PHONE.PPS
< prev
Wrap
Text File
|
1996-05-19
|
7KB
|
233 lines
; PHONE.PPE - Written by Dan Shore - April 19, 1996
;
; Get telephone information from user record. If phone information
; is blank or is not in the xxx-xxx-xxxx format, the user will
; be REQUIRED to change it. This "proper" format will be then
; used by CB-FREE for a callback number.
;
;────────────────────────────────────────────────────────────────────────
;
; Installation:
; ────────────
;
; Use your Security Specific files to run this PPE.
;
; In PCBSETUP:
;
; File Location/System Files & Dir/Location of Login Security Files
;
; Inside the Security Specific file you would have the entry:
;
; !c:\pcb\ppe\phone\phone.ppe 100
;
; The second parameter is the security level to bypass the PPE. Any
; security level greater than or equal to this level is exempt from
; this PPE.
;
;────────────────────────────────────────────────────────────────────────
STRING user_input ' Generic user input
STRING user_choice ' User choice for editing information
STRING main_prompt ' Generic INPUTSTR prompt
STRING a1 ' Data Phone
STRING a2 ' Home Phone
STRING key ' Get keystrokes from user
INT count ' Counts keystrokes from user
BOOLEAN editing_info ' Flag for when user is editing
;────────────────────────────────────────────────────────────────────────
'
' Run PPE only if in conference 0 - Main
'
IF (CURCONF() = 0) THEN
'
' Get user record information
'
GETUSER
'
' Get the users address information
'
a1 = TRIM(U_BDPHONE," ")
a2 = TRIM(U_HVPHONE," ")
GOSUB CHECK_GET_INFO
END IF
END
'
' Check phone number and get user input
'
:CHECK_GET_INFO
'
' Check to see if phone info is blank, invalid format, or too short
'
' If information is OK, the PPE will just exit.
'
IF (a1 = "" || a2 = "" || editing_info \
|| LEN(a1) < 12 || MID(a1,4,1) != "-" || MID(a1,8,1) != "-" \
|| LEN(a2) < 12 || MID(a2,4,1) != "-" || MID(a2,8,1) != "-") THEN
'
' If too short or invalid set variable to blank
'
IF (LEN(a1) < 12 || MID(a1,4,1) != "-" || MID(a1,8,1) != "-") a1 = ""
IF (LEN(a2) < 12 || MID(a2,4,1) != "-" || MID(a2,8,1) != "-") a2 = ""
'
' Display notice only once
'
if (!editing_info) GOSUB DISPLAY_NOTICE
editing_info = TRUE
'
' Make choice for user on field to edit. If all fields are
' filled, ask user to make a selection.
'
IF (a1 = "") THEN
user_input = "1"
ELSEIF (a2 = "") THEN
user_input = "2"
ELSE
'
' Display seperator and prompt
'
NEWLINE
PRINTLN "@X0F*@X0D──────────────────────────────────────────────────────────────────@X0F*"
NEWLINE
PRINTLN " @X0FHere are your current Data/Business and Home/Voice Phone Numbers"
NEWLINE
'
' Display current phone information
'
PRINTLN " @X0A Data Phone Number @X0F= @X0E", a1
PRINTLN " @X0AHome/Voice Phone Number @X0F= @X0E", a2
'
' Display Menu and get selection from user
'
user_input = ""
NEWLINE
PRINTLN " @X0F1 - @X0DEdit Data/Business Phone Number@X07"
PRINTLN " @X0F2 - @X0DEdit Home/Voice Phone Number@X07"
PRINTLN " @X0F3 - @X0BExit and Save Phone Information@X07"
NEWLINE
main_prompt = " @X0EPress [@X0F1@X0E], [@X0F2@X0E], or [@X0F3@X0E] as your selection"
INPUTSTR main_prompt, user_input, @X0E, 1, "123", LFAFTER+UPCASE+FIELDLEN+GUIDE
END IF
user_choice = user_input
'
' Process selection (1, 2 or 3)
'
GOSUB SELECT_SECTION
'
ELSE
'
' Phone information is fine, exit the PPE
'
END
'
END IF
'
' Loop back up to top of subroutine
'
GOTO CHECK_GET_INFO
'
' Edit information based on users choice
'
:SELECT_SECTION
user_input = ""
NEWLINE
SELECT CASE (user_choice)
'
' Edit Data/Business
'
CASE "1"
user_input = ""
count = 0
PRINT "@X0E Enter Data Phone Number. Format: ###-###-#### (@X0F"
WHILE (1) DO
key = INKEY()
IF (key >= "0" && key <= "9") THEN
user_input = user_input + key
PRINT key
INC count
key = ""
IF (count = 12) BREAK
IF (count = 3 || count = 7) THEN
PRINT "-"
user_input = user_input + "-"
INC count
END IF
END IF
DELAY 3
END WHILE
a1 = user_input
COLOR @X07
'
' Edit Home/Voice
'
CASE "2"
user_input = ""
count = 0
PRINT "@X0E Enter Voice Phone Number. Format: ###-###-#### (@X0F"
WHILE (1) DO
key = INKEY()
IF (key >= "0" && key <= "9") THEN
user_input = user_input + key
PRINT key
INC count
key = ""
IF (count = 12) BREAK
IF (count = 3 || count = 7) THEN
PRINT "-"
user_input = user_input + "-"
INC count
END IF
END IF
DELAY 3
END WHILE
a2 = user_input
COLOR @X07
'
' Exit and save information
'
CASE 3
'
' Write information to user record variables and
' write to the user record and end PPE
'
U_BDPHONE = a1
U_HVPHONE = a2
PUTUSER
PRINTLN "@X0F...Thank you @FIRST@, for completing the information...@X07"
NEWLINE
END
END SELECT
RETURN
'
' Display notice to user informing them of invalid phone number info
'
:DISPLAY_NOTICE
PRINTLN "@X0E┌──────────────────────────────────────────────────@X0E┐"
PRINTLN "│@X0CWe have detected an error in the phone number(s) @X0E│"
PRINTLN "│@X0Cyou entered as a new user. Please correct any @X0E│"
PRINTLN "│@X0Cinformation for the proper format. @X0E│"
PRINTLN "│ @X0E│"
PRINTLN "│@X0BChoose choice #3 to Exit and Save your corrections@X0E│"
PRINTLN "└──────────────────────────────────────────────────┘"
NEWLINE
RETURN